package taskTracker.ui.lite;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.TextBox;

import org.j4me.logging.LogMessage;

import com.sun.lwuit.TextField;

/**
 * Views given log messages in a TextBox
 * @author aseldawy
 *
 */
public class LogViewer extends TextBox {

	public LogViewer(LogMessage[] logMessages) {
		super("Log messages", "", 16384, TextField.ANY);
		String text = "";
		for (int i=0; i < logMessages.length;i++) {
			LogMessage logMessage = logMessages[i];
			text += "("+logMessage.level+")";
			text += logMessage.time + ": ";
			text += logMessage.message + "\n";
		}
		super.setString(text);

		super.addCommand(new Command("Back", Command.BACK, 1));
	}

}
